using System;
using UnityEngine;

public class TableProfile : MonoBehaviour
{
	[Serializable]
	private class Profile
	{
		public SpriteRenderer leftRail;

		public SpriteRenderer rightRail;

		public SpriteRenderer leftTopRail;

		public SpriteRenderer leftBottomRail;

		public SpriteRenderer rightTopRail;

		public SpriteRenderer rightBottomRail;
	}

	[SerializeField]
	private Color[] m_Colors;

	[SerializeField]
	private Profile m_Profile;

	[SerializeField]
	private SpriteRenderer[] m_SurfaceProfile;

	public void SetProfile(int profile)
	{
		string str = "TableProfile/Profile" + profile + "/";
		m_Profile.leftRail.sprite = Resources.Load<Sprite>(str + "VerticalRail");
		m_Profile.rightRail.sprite = Resources.Load<Sprite>(str + "VerticalRail");
		m_Profile.leftTopRail.sprite = Resources.Load<Sprite>(str + "HorizontalTopRail");
		m_Profile.leftBottomRail.sprite = Resources.Load<Sprite>(str + "HorizontalBottomRail");
		m_Profile.rightTopRail.sprite = Resources.Load<Sprite>(str + "HorizontalTopRail");
		m_Profile.rightBottomRail.sprite = Resources.Load<Sprite>(str + "HorizontalBottomRail");
	}

	public void SetSurfaceColor(int index)
	{
		if (index >= 0 && index < m_Colors.Length)
		{
			for (int i = 0; i < m_SurfaceProfile.Length; i++)
			{
				m_SurfaceProfile[i].color = m_Colors[index];
			}
		}
		SetProfile(index);
	}
}
